<?php
/*
 * fichier de connexion à la DB
 */
try{
    
    $db = new PDO( "mysql:host=$db_host;dbname=$db_name;charset=UTF-8",
            $db_user,
            $db_pwd
    );
    
    $db->query("SET NAMES 'utf-8'");
    $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e){
    error_log($e->getMessage());
    die("A database error was encountered, please try later");
}

?>
